#!/usr/bin/python3
# -*- coding:utf-8 -*-
""""
@Author: 李吉凯
@Email: lijk34925@hundsun.com
@Time: 2022/5/25 16:48
@File: page.py
"""
import re

from BladeFerm.hui_app.hui_lib.page import Page as HuiPage


class Page(HuiPage):

    def get_rows_in_page(self):
        '''
        获取表格页显示的行数

        :Return:
            返回表格页显示的行数

        :Example:
         - 例: page.get_rows_in_page()
        '''
        rows_div = self._element.exist(
            'css selector', 'span.h-page-total',
            timeout=self.timeout)
        if rows_div:
            rows_text = rows_div.text
            rows = int(re.search(r'\d+', rows_text).group())
            return rows
        else:
            return 0